package Day9Zuoye;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Xmlchaoshi c=new Xmlchaoshi();
        while (true){
            System.out.println("1:查看商品信息 2:查找商品信息 3:修改商品数量 4:购买商品 5:添加新商品 9:退出");
            Scanner sc = new Scanner(System.in);
            int choice = sc.nextInt();
            if (choice==1){
                c.show();
            }else if (choice==2){
                System.out.println("请输入要查找的商品号码");
                int a = sc.nextInt();
                c.selectItemno(a);
            }else if (choice==3){
                System.out.println("输入商品编号：");
                int a = sc.nextInt();
                System.out.println("输入修改的数量：");
                int b = sc.nextInt();
                c.Modifyskct(a, b);
            }else if (choice==4){
                System.out.println("输入商品编号：");
                int a = sc.nextInt();
                System.out.println("输入购买的数量：");
                int b = sc.nextInt();
                c.goumai(a, b);
            }else if (choice==5){
                System.out.println("输入商品编号");
                int itemno = sc.nextInt();
                System.out.println("输入商品名称");
                String name = sc.next();
                System.out.println("输入商品是否打折");
                String shifou = sc.next();
                boolean discount;
                if (shifou.equals("是")) {
                    discount = true;
                } else {
                    discount = false;
                }
                System.out.println("输入商品厂家");
                String factoryaddr = sc.next();
                System.out.println("输入商品价格");
                double price = sc.nextDouble();
                System.out.println("输入商品库存");
                int stockcount = sc.nextInt();
                System.out.println("输入商品计价单位");
                String unit = sc.next();
                c.add(discount, factoryaddr, itemno, name, price, stockcount, unit);
            }else if (choice==9){
                return;
            }
        }
    }
}
